package com.woniuxy.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: mayuhang  <br/>
 * Date: 2021/3/25:14:30  <br/>
 * Description: 备用交换机(其实就是一个基础的广播交换机)，用于处理 路由不到队列的数据
 */
@Configuration
public class AlternateExchangeConfig {
    public static final String ALTERNAME_EXCHANGE="Ex.Altername";
    public static final String ALTERNAME_QUEUE="MQ.unrouteQueue";
    /**
     * @author: mayuhang  <br/>
     * Date: 2021/3/25:15:06  <br/>
     * Description:广播交换机
     */
    @Bean
    public FanoutExchange alternameExchange(){
        return new FanoutExchange(ALTERNAME_EXCHANGE);
    }
    @Bean
    public Queue alternameQueue(){
        return new Queue(ALTERNAME_QUEUE);
    }
    @Bean
    public Binding bindingAlterQueue(){
        return BindingBuilder.bind(alternameQueue()).to(alternameExchange());
    }
}
